package cn.kmia.hrm.action.system;

import cn.kmia.hrm.pojo.system.Permission;
import cn.kmia.hrm.service.system.PermissionService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import java.util.List;

/**
 * @program: hrm
 * @description: 权限操作类
 * @author: 4K
 * @create: 2018-04-16 14:35
 **/
@IocBean
@At("/per")
public class PerAction {

    private static final Log log = Logs.get();

    @Inject
    protected PermissionService permissionService;

    /**
     * 查询可用权限列表
     * @return
     */
    @At("/query")
    @Ok("json:full")
    @RequiresPermissions("per:query")
    public List<Permission> query(@Param("name") String name) {
        return permissionService.query(name);
    }
}
